package com.hliushi.learn.jms;

import org.springframework.jms.core.JmsMessagingTemplate;

import javax.annotation.Resource;
import javax.jms.Destination;

/**
 * @ClassName MsgProducer
 * @Description 消息发送者
 * @Author liushi
 * @Date 2021/7/9 9:07
 * @Version V1.0
 **/
// @Service
public class MsgProducer {

    @Resource
    private JmsMessagingTemplate jmsMessagingTemplate;


    /**
     * 发送消息
     *
     * @param destination 消息发送的目的地
     * @param msg         消息内容
     */
    public void sendMessage(Destination destination, String msg) {
        jmsMessagingTemplate.convertAndSend(destination, msg);
    }
}
